import React, { Component } from 'react'
import { Button } from 'antd'
// hoc
// 是个函数, 参数是组件,返回值是新组件
const foo = Cmp => props => (
    <div className="border">
        <Cmp {...props} />
    </div>
)

function Child(props) {
    return <div>child---{props.name}</div>
}

const Foo = foo(foo(Child))


// 装饰器
@foo
@foo
class ChildList extends Component {
    render() {
        return (
            <div>ChildList ---{this.props.name}</div>
        )
    }
}

export default class HocPage extends Component {
    render() {
        return (
            <div>
                <Foo name="marry" />
                <ChildList name="Jack" />
                <Button type="primary">Antd</Button>
            </div>
        )
    }
}
